114b059fc0146d98450e2d6bdd854914c8e30f43,tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/AbstractNewSlingApplicationWizard.java,AbstractNewSlingApplicationWizard,performFinish,#IProgressMonitor#,155
Before Change
return false;
}
monitor.worked(2);
if (monitor.isCanceled()) {
return false;
}
After Change
return false;
}
IServer server = setupServerWizardPage.getOrCreateServer();
monitor.worked(1);
if (monitor.isCanceled()) {
return false;
}
List<IProject> projects = MavenPlugin.getProjectConfigurationManager().createArchetypeProjects(
location, archetype, groupId, artifactId, version, javaPackage, properties, configuration, monitor);
monitor.worked(3);
if (monitor.isCanceled()) {
return false;
}
List<IProject> contentProjects = new LinkedList<IProject>();
List<IProject> bundleProjects = new LinkedList<IProject>();
IProject reactorProject = null;
for (Iterator<IProject> it = projects.iterator(); it.hasNext();) {
IProject project = it.next();
IFile pomFile = project.getFile("pom.xml");
if (!pomFile.exists()) {
// then ignore this project - we only deal with maven projects
continue;
}
final Model model = MavenPlugin.getMavenModelManager().readMavenModel(pomFile);
final String packaging = model.getPackaging();
if ("content-package".equals(packaging)) {
contentProjects.add(project);
} else if ("bundle".equals(packaging)) {
bundleProjects.add(project);
} else if ("pom".equals(packaging)) {
if (reactorProject==null) {
reactorProject = project;
} else {
IPath currLocation = project.getFullPath();
IPath prevLocation = reactorProject.getFullPath();
if (currLocation.isPrefixOf(prevLocation)) {
// assume reactor is up in the folder structure
reactorProject = project;
}
}
}
}
monitor.worked(1);
if (monitor.isCanceled()) {
return false;
}
for (Iterator<IProject> it = contentProjects.iterator(); it.hasNext();) {
IProject aContentProject = it.next();
configureContentProject(aContentProject, projects, monitor);
}
for (Iterator<IProject> it = bundleProjects.iterator(); it.hasNext();) {
IProject aBundleProject = it.next();
configureBundleProject(aBundleProject, projects, monitor);
}
configureReactorProject(reactorProject, monitor);
monitor.worked(1);
if (monitor.isCanceled()) {
return false;
}
finishConfiguration(projects, server, monitor);
monitor.worked(1);
if (monitor.isCanceled()) {
return false;
}
updateProjectConfigurations(projects, true, monitor);
monitor.worked(1);
if (monitor.isCanceled()) {
return false;
}
IServerWorkingCopy wc = server.createWorkingCopy();
// add the bundle and content projects, ie modules, to the server
List<IModule> modules = new LinkedList<IModule>();
for (Iterator<IProject> it = bundleProjects.iterator(); it.hasNext();) {
IProject project = it.next();
IModule module = ServerUtil.getModule(project);
modules.add(module);
}
for (Iterator<IProject> it = contentProjects.iterator(); it.hasNext();) {
IProject project = it.next();
IModule module = ServerUtil.getModule(project);
modules.add(module);
}
wc.modifyModules(modules.toArray(new IModule[modules.size()]), new IModule[0], monitor);
IServer newServer = wc.save(true, monitor);
newServer.start(ILaunchManager.RUN_MODE, monitor);
monitor.worked(2);
if (monitor.isCanceled()) {
return false;
}
ILaunchConfiguration launchConfig =
DebugPlugin.getDefault().getLaunchManager().getLaunchConfiguration(reactorProject.getFolder(".settings").getFolder(".launches").getFile("initial_install.launch"));
if (launchConfig!=null) {
ILaunch theLaunch = launchConfig.launch(ILaunchManager.RUN_MODE, monitor, true);
monitor.setTaskName("mvn install");
while(!theLaunch.isTerminated()) {
Thread.sleep(500);
monitor.worked(1);
}
}
wc.getOriginal().publish(IServer.PUBLISH_FULL, monitor);
// also add 'java 1.6' and 'jst.ejb 3.1'
// IFacetedProject fp2 = ProjectFacetsManager.create(uiProject, true, null);
// IProjectFacet java = ProjectFacetsManager.getProjectFacet("java");
// fp2.installProjectFacet(java.getVersion("1.6"), null, null);
// IProjectFacet dynamicWebModule = ProjectFacetsManager.getProjectFacet("jst.web");
// fp2.installProjectFacet(dynamicWebModule.getLatestVersion(), null, null);
monitor.worked(2);
updateProjectConfigurations(projects, false, monitor);
monitor.worked(1);
monitor.done();
return true;
}